<!--
    Author : Christian Hadiwinoto 13507081
-->
<?php if (isset($pesan))echo $pesan;?>
<head>
	<title>Edit Ruangan</title>


        <!--JQuery Library-->
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/jquery-ui-1.8.11.custom/css/blitzer/jquery-ui-1.8.12.custom.css" />
        <script type="text/javascript" src="<?php echo base_url(); ?>assets/jquery-ui-1.8.11.custom/js/jquery-1.5.1.min.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>assets/jquery-ui-1.8.11.custom/js/jquery-ui-1.8.11.custom.min.js"></script>
</head>
<h3>Form Edit Ruangan</h3>
<?php echo $formEdit; ?>
<script type="text/javascript">
    // Validasi Form
    $('#formEditRuangan').submit(function() {
        var error = false;
        var errmsg = "";
        document.formEditRuangan.roomId.value = jQuery.trim($('#edRoomId').val());
        document.formEditRuangan.roomName.value = jQuery.trim($('#roomName').val());
        document.formEditRuangan.description.value = jQuery.trim($('#description').val());
        if (!this.edRoomId.value.match(/^\S+/)) {
            errmsg += "ID ruangan tidak boleh kosong atau mengandung spasi.";
            error = true;
        }
        if (!this.roomName.value.match(/^.+/)) {
            if (error) errmsg += '\n'; //newline jika sudah ada pesan sebelumnya
            errmsg += "Nama ruangan tidak boleh kosong.";
            error = true;
        }
        if (!this.pjRuangan.value.match(/^.+/)) {
            if (error) errmsg += '\n'; //newline jika sudah ada pesan sebelumnya
            errmsg += "PJ Ruangan harus dipilih.";
            error = true;
        }
        if (error) {
            alert(errmsg);
            return false;
        }
    });
</script>